<title><#if pager??>编辑<#else>新增</#if>商品库存</title>
<style>
	.unitcss{
   margin-top: -34px;
    margin-left: 253px;
    position: fixed;
    height: 34px;
	}
</style>
<div class="page-header">
	<h1>
		<#if pager??>编辑<#else>新增</#if>商品库存
		<small>
			<i class="icon-double-angle-right"></i>
		</small>
	</h1>
</div>

<form class="form-horizontal" role="form" id="validation-form" method="POST" action="${ctx}/admin/record/dosave${suffix}" enctype="multipart/form-data">
<#if pager??>
	<input type="hidden" name="id" value="${pager.id}"/>
</#if>

<fieldset>
<div class="form-group">
	<label class="control-label col-xs-12 col-sm-3 no-padding-right">商品名称:</label>
	<div class="col-xs-12 col-sm-9">
		<div class="clearfix">
			<@device cmd="get_goods_list">
				<@ace.formSingleSelect options=goodsList checkValue=(goodsId)!-1 name="goodsId" listKey="id" listValue="name"/>
			</@device>
		</div>
	</div>
</div>
<div class="form-group">
	<label class="control-label col-xs-12 col-sm-3 no-padding-right">配送至:</label>
	<div class="col-xs-12 col-sm-9">
		<div class="clearfix">
			<@device cmd="get_estate_list">
				<@ace.formSingleSelect1 options=estateList checkValue=(relativeId)!-1 name="relativeId" listKey="id" listValue="name"/>
			</@device>
		</div>
	</div>
</div>
<div class="form-group">
	<label class="control-label col-xs-12 col-sm-3 no-padding-right" for="amount">数量:</label>
	<div class="col-xs-12 col-sm-9">
		<div class="clearfix">
			<span class="block input-icon width-20">
				<input type="text" name="amount" id="amount" value="${amount!}" class="form-control" placeholder=""/>
				<#assign goodsTypes=dicSetting.getParameterMap("goods.unit") />
				<@ace.formSingleSelect options=goodsTypes checkValue=(pager.unit)!-1 name="unit" listKey="key" listValue="value" />
				
			</span>
		</div>
	</div>
</div>
<div class="form-group">
	<label class="control-label col-xs-12 col-sm-3 no-padding-right" title="商品的规格如:1800mm*2500mm(长宽) 可为空">规格:</label>
	<div class="col-xs-12 col-sm-9">
		<div class="clearfix">
			<span class="block input-icon width-20">
				<input type="text" name="spec" id="spec" value="" class="form-control" placeholder="450ml/瓶"/>
			</span>
		</div>
	</div>
</div>
<div class="form-group">
	<label class="control-label col-xs-12 col-sm-3 no-padding-right" title="商品的型号 GB/T20808 可为空">型号:</label>
	<div class="col-xs-12 col-sm-9">
		<div class="clearfix">
			<span class="block input-icon width-20">
				<input type="text" name="model" id="spec" value="" class="form-control" placeholder="GB/T20808"/>
			</span>
		</div>
	</div>
</div>
<div class="form-group">
	<div class="col-md-offset-3 col-md-9">
		<button class="btn btn-info" type="submit"><i class="icon-ok bigger-110"></i>提  交</button>
		&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
		<button class="btn" type="reset"><i class="icon-undo bigger-110"></i>重  置</button>
	</div>
</div>
</fieldset>
</form>
<#if errorMsg??>
	<div class="hr hr-18 hr-double dotted"></div>
	<h4 class="lighter">
		<i class="icon-hand-right icon-animated-hand-pointer red"></i>
		<span class="pink">${errorMsg}
		</span>
	</h4>
</#if>


<script>
$(document).ready(function(){
	$("#unit").addClass("unitcss");
	RP.addBreadcrumb([{name:"返回库存列表", active: false, linkUrl:"${ctx}/admin/record/list${suffix}"}, {name:"添加商品入库",  active: true}]);
	$('#id-input-file-1').ace_file_input({
		no_file:'没文件 ...',
		btn_choose:'请选择文件',
		btn_change:'重新选择文件',
		droppable:false,
		onchange:null,
		thumbnail:false
	});
	
	$('#validation-form').validate({
		errorElement: 'div',
		errorClass: 'help-block',
		focusInvalid: true,
		rules: {
			amount:{
				required:true,
				number: true
			},
			goodsId:{
				required:true
			}
		},
	
		messages: {
			goodsId: {
				required: "请选择有效的商品"
			},
			amount: {
				required: "请输入商品数量和单位"
			}
		},
	
		invalidHandler: function (event, validator) { //display error alert on form submit   
			RP.Form.invalidHandler(event, validator);
		},
	
		highlight: function (e) {
			RP.Form.highlight(e);
		},
		
		errorPlacement: function (error, element) {
			RP.Form.errorPlacement(error, element);	
		},
	
		success: function (e) {
			RP.Form.success(e);	
		},
		
		submitHandler: function(form) {
			RP.Form.submitHandler(form);
		}
	});
});
</script>